<?php
/**
 * BlockStObory
 * 
 * @author Radovan Dvorsky
 * @version 20100513
 */

require_once 'Zend/Db/Table/Abstract.php';

class Db_DbTable_BlockStObory extends Zend_Db_Table_Abstract {
	
	/**
	 * Database name
	 * @var string
	 */
	protected $_dbName; 
	
	
	/**
	 * The default table name 
	 */
	protected $_name = 'block_St_obory';
	
	/**
	 * Primary key
	 */
	protected $_primary = array('Id_oboru','bid');
	
	/**
	 * Parrent tables description 
	 */	
	protected $_referenceMap = array(
		'Block' => array(
			'columns' => array('bid'),
			'refTableClass' => 'Db_DbTable_Block',
			'refColumns' => array('bid'),
			'onDelete' => self::CASCADE,	
		),
		'Obor' => array(
			'columns' => array('Id_oboru'),
			'refTableClass' => 'Db_DbTable_StObory',
			'refColumns' => array('Id_oboru'),				
		)
	);
	
	public function init(){		
		/*
		 * Nastav adapter pre databazu
		 */
		$this->_setAdapter(Zend_Registry::get('db'));
		$config = Zend_Registry::get('config');
		
		/*
		 * Inicializuj premenu s menom druhej databaze
		 */
		$this->_dbName = $config->database->params->dbname;		
	}

}

